<!--{eval
$title = 'mzphp 用户登录';
}-->
<!--{template header}-->
<form id="login-form">
    用户：<input type="text" name="username" id="username"/><br>
    密码：<input type="password" name="password" id="password"/><br>
    验证：<img src="?c=auth-checkcode" id="checkimg"/><Br>
    输入：<input type="text" name="checkcode" id="checkcode"/><Br>
    <input type="submit">
</form>
<!--{template footer}-->
<script>
    $('#login-form').on('submit', function () {
        window.API.post('auth-login', {
            username: $('#username').val(),
            password: $('#password').val(),
            CHECK_CODE: $('#checkcode').val()
        }, function (data) {
            if (data.error) {
                alert(data.data);
                $('#checkimg').attr('src', '?c=auth-checkcode&' + Math.random());
            } else {
                document.location.reload();
            }
        });
        return false;
    });
</script>